package com.esri.core.map.popup;

import java.text.NumberFormat;

/* loaded from: classes.dex */
public class PopupNumberFormatValue extends PopupFormatValue {
    NumberFormat a;

    public PopupNumberFormatValue() {
        this.a = null;
        this.a = NumberFormat.getInstance();
    }

    public PopupNumberFormatValue(int i, boolean z) {
        this();
        this.a.setGroupingUsed(z);
        this.a.setMaximumFractionDigits(i);
        this.a.setMinimumFractionDigits(i);
    }

    public int getPlaces() {
        return this.a.getMaximumFractionDigits();
    }

    public void setPlaces(int i) {
        this.a.setMaximumFractionDigits(i);
        this.a.setMinimumFractionDigits(i);
    }

    public boolean getDigitSeparator() {
        return this.a.isGroupingUsed();
    }

    public void setDigitSeparator(boolean z) {
        this.a.setGroupingUsed(z);
    }

    @Override // com.esri.core.map.popup.PopupFormatValue
    public String formattedValue(Object obj) {
        if (!(obj instanceof Number)) {
            return String.valueOf(obj);
        }
        Number number = (Number) obj;
        return ((obj instanceof Double) || number.doubleValue() != ((double) number.longValue())) ? this.a.format(number.doubleValue()) : this.a.format(number.longValue());
    }
}
